<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试windowConfirm</title>
</head>
<body>
<button onclick="testWindowConfirm()">测试windowConfirm</button>
<br/>
<div id="div"></div>
<script type="text/javascript">
    function testWindowConfirm() {
        let b = window.confirm("确认？");
        //会弹出一个框，让你确定和取消
        if(b){
            document.getElementById("div").innerHTML="您点击了《确定》"
        }else{
            document.getElementById("div").innerHTML="您点击了《取消》"
        }
    }
</script>
</body>
</html>